<template>
  <view class="styleWork">
    <!-- <toast></toast> -->
    <!-- <u-navbar title="财务中心" :bgColor="navbarClass.titleBgColor" @leftClick="backHome" :placeholder="true"> </u-navbar> -->
    <image class="image1" src="../../static/image/workImage1.png" mode="" />
    <view class="workCont" v-for="(v, i) in dtNewsVoList" :key="i">
      <view class="workHead" v-if="i == 0"> 工作动态 </view>
      <!-- <view class="text1" @click="gotoWebview(v.content)" v-for="(v, i) in v" :key="i"> -->
      <view class="text1" v-for="(v, i) in v" :key="i" @click="gotoJump('/pageContent/affair/message', v)">
        <text class="txt2 u-line-1">{{ v.title }}</text>
        <u-icon name="arrow-right" color="#999" size="18"></u-icon>
      </view>
    </view>
    <view class="loading" v-if="loadingShow && page == 1"><u-loading-icon></u-loading-icon></view>
  </view>
  <!-- https://mp.weixin.qq.com/s/eF2HKUM4e6U2ehZSfroFTg -->
</template>
<script>
export default {
  data() {
    return {
      loadingShow: true,
      dtNewsVoList: [],
      listCont: 0,
      loadStatus: true,
      page: 1,
    }
  },
  onLoad(options) {
    this.findArticleList()
  },
  methods: {
    findArticleList() {
      this.loadingShow = true
      this.$https
        .post({
          url: '/axh/articleManage/findArticleList',
          data: {
            oneClassifyId: 4,
            twoClassifyId: '',
            threeClassifyId: '',
            fourClassifyId: '',
            page: this.page,
            limit: 9,
            title: '',
            status: 1,
            phoneAuth: 1,
          },
        })
        .then((data) => {
          this.page++
          this.loadingShow = false
          this.listCont = Math.ceil(data.result.dtNewsVoList.length / 3)
          let newArr = data.result.dtNewsVoList
          for (let i = 0; i < this.listCont; i++) {
            this.dtNewsVoList.push(newArr.slice(i * 3, (i + 1) * 3))
          }

          if (this.dtNewsVoList && this.dtNewsVoList.length * 3 >= data.result.total) {
            this.loadStatus = false
          }
        })
    },

    gotoJump(url, item) {
      if (item.articleType == 2) {
        //#ifdef H5
        location.href = item.content
        //#endif
      } else {
        uni.navigateTo({
          url: `${url}?id=${item.id}`,
        })
      }
    },
  },

  onReachBottom() {
    if (this.loadStatus == false) {
      this.$u.toast('没有更多内容啦')
    } else {
      this.findArticleList()
    }
  },
}
</script>

<style lang="scss" scoped>
.styleWork {
  background: #f6f6f6;
  min-height: 100vh;
  .image1 {
    width: 100%;
    height: 290rpx;
    margin-bottom: 24rpx;
  }

  .workCont {
    background: #ffffff;
    padding: 24rpx;
    margin-bottom: 24rpx;

    .workHead {
      position: relative;
      color: #333333;
      font-size: 34rpx;
      margin-left: 20rpx;
      margin-bottom: 22rpx;
      &::after {
        content: '';
        position: absolute;
        left: -20rpx;
        top: 8rpx;
        width: 10rpx;
        height: 30rpx;
        background: #3882eb;
        border-radius: 50rpx;
      }
    }
  }
  .text1 {
    display: flex;
    justify-content: space-between;
    padding: 24rpx 0;
    color: #333333;
    .txt2 {
      width: 560rpx;
      line-height: 1.7;
    }
  }
}
.loading {
  margin-top: 30rpx;
}
</style>
